<include file='Public/header'/> 
   <style> 
        .vc-cells .vc-img-cell .cell-text{ margin-left: 0px;}
        .vc-cells .vc-img-cell .cell-time.actime{text-align: left;margin-top:5px;margin-bottom:5px;}
        .vc-cells .vc-img-cell .cell-subtitle{white-space:unset;}
        .vc-cells .vc-img-cell .cell-text{width:100%!important;}
        .weui-cell__hd,.weui-cell__bd select,.weui-cell__bd input{font-size:14px;}
    </style>
</head>
<body> 
    
    <include file='Public/navigationer'/> 

    <div class="weui-cells weui-cells_form" style="margin-top:0.8em;padding-bottom: 65px;">
        <form id="ssform">  
        
        <div class="weui-cell">
            <div class="weui-cell__hd"><label for="date" class="weui-label">选择项目</label></div>
            <div class="weui-cell__bd">
                <select class="weui-select" name="project_id" id="project_id" style='padding-left: 0px;'>
                    <option selected="" value="">请选择项目</option>  
                    <volist name='projectList' id='pv'>
                        <option value="{$pv.id}">{$pv.title}</option>
                    </volist> 
                </select> 
            </div>
        </div>  

        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">客户姓名</label></div>
            <div class="weui-cell__bd">
              <input class="weui-input" type="text" name='name' id='name' placeholder="请输入客户姓名">
            </div>
        </div> 
        <div class="weui-cell">
            <div class="weui-cell__hd"><label for="" class="weui-label">联系电话</label></div>
            <div class="weui-cell__bd">
              <input class="weui-input" type="tel" value="" name='tel' id='tel' placeholder="请输入电话号码">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">经纪人公司</label></div>
            <div class="weui-cell__bd">
              <input class="weui-input" type="text" name='jjcompany' id='jjcompany' placeholder="请输入经纪人公司">
            </div>
        </div> 
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">经纪人姓名</label></div>
            <div class="weui-cell__bd">
              <input class="weui-input" type="text" name='jjname' id='jjname' placeholder="请输入经纪人姓名">
            </div>
        </div> 
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">经纪人电话</label></div>
            <div class="weui-cell__bd">
              <input class="weui-input" type="text" name='jjtel' id='jjtel' placeholder="请输入经纪人电话">
            </div>
        </div> 
        <div class="weui-btn-area">
            <a class="weui-btn weui-btn_warn" href="javascript:" id="showTooltips" onclick="ajaxSubmit(this);">提交</a>
        </div>
        </form>
    </div>
    
    <include file='Public/comjs'/> 
    <!-- private -->
    <script src="__PUBLIC__/Wap/js/vc-utils.js"></script>
    <script> 
    function ajaxSubmit(ob){
        $(ob).addClass('weui-btn_disabled');
        $(ob).text('数据提交中.....');
        var project_id = $("#project_id").val();
        var name = $("#name").val();
        var tel = $("#tel").val();
        var jjcompany = $("#jjcompany").val();
        var jjname = $("#jjname").val();
        var jjtel = $("#jjtel").val(); 
        if( project_id == ''){
            $.toast("请选择项目", "text");
            $(ob).removeClass('weui-btn_disabled');
            $(ob).text('提交');
            return false ;
        }
        if( name == ''){
            $.toast("请填写客户名称", "text");
            $(ob).removeClass('weui-btn_disabled');
            $(ob).text('提交');
            return false ;
        }
        if( tel == ''){
            $.toast("请填写客户电话", "text");
            $(ob).removeClass('weui-btn_disabled');
            $(ob).text('提交');
            return false ;
        }
        if( jjcompany == ''){
            $.toast("请填写经纪人公司", "text");
            $(ob).removeClass('weui-btn_disabled');
            $(ob).text('提交');
            return false ;
        }
        if( jjname == ''){
            $.toast("请填写经纪人姓名", "text");
            $(ob).removeClass('weui-btn_disabled');
            $(ob).text('提交');
            return false ;
        }
        if( jjtel == ''){
            $.toast("请填写经纪人电话", "text");
            $(ob).removeClass('weui-btn_disabled');
            $(ob).text('提交');
            return false ;
        }
        var param = $("#ssform").serialize();
        $.showLoading();
        $.post("{:U('baobeiadd')}",param,function(result){
            $.hideLoading();
            if(result.status==1){
                $.toast(result.info, "text");
                setTimeout(function(){
                    window.location.href = "{:U('baobei')}";
                },1500)
            }else{
                $.toast(result.info, "text");
                $(ob).removeClass('weui-btn_disabled');
                $(ob).text('提交');
            }
        },'json');   
    }
    </script> 
</body>
</html>